"use strict";(globalThis.webpackChunk_github_ui_github_ui=globalThis.webpackChunk_github_ui_github_ui||[]).push([["packages_item-picker_components_RepositoryPicker_tsx"],{16654:(e,l,a)=>{a.d(l,{f0:()=>_,i_:()=>w,tZ:()=>L,vO:()=>T,St:()=>P,Jo:()=>v,Er:()=>R});var n=a(74848);let i=function(){var e={defaultValue:null,kind:"LocalArgument",name:"name"},l={defaultValue:null,kind:"LocalArgument",name:"owner"},a=[{kind:"Variable",name:"name",variableName:"name"},{kind:"Variable",name:"owner",variableName:"owner"}],n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"databaseId",storageKey:null},s={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"nameWithOwner",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"login",storageKey:null},o={alias:null,args:[{kind:"Literal",name:"size",value:64}],kind:"ScalarField",name:"avatarUrl",storageKey:"avatarUrl(size:64)"},u={alias:null,args:null,kind:"ScalarField",name:"issueTypesEnabled",storageKey:null},d={alias:null,args:null,kind:"ScalarField",name:"isLocked",storageKey:null},c={alias:null,args:null,kind:"ScalarField",name:"isPrivate",storageKey:null},m={alias:null,args:null,kind:"ScalarField",name:"visibility",storageKey:null},g={alias:null,args:null,kind:"ScalarField",name:"isArchived",storageKey:null},y={alias:null,args:null,kind:"ScalarField",name:"isInOrganization",storageKey:null},p={alias:null,args:null,kind:"ScalarField",name:"hasIssuesEnabled",storageKey:null},k={alias:null,args:null,kind:"ScalarField",name:"hasAnyTemplates",storageKey:null},f={alias:null,args:null,kind:"ScalarField",name:"slashCommandsEnabled",storageKey:null},h={alias:null,args:null,kind:"ScalarField",name:"viewerCanPush",storageKey:null},b={alias:null,args:null,kind:"ScalarField",name:"isBlankIssuesEnabled",storageKey:null},F={alias:null,args:[{kind:"Literal",name:"action",value:"create an issue"}],kind:"ScalarField",name:"viewerInteractionLimitReasonHTML",storageKey:'viewerInteractionLimitReasonHTML(action:"create an issue")'},S={alias:null,args:null,concreteType:"IssueCreationPermissions",kind:"LinkedField",name:"viewerIssueCreationPermissions",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"labelable",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"milestoneable",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"assignable",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"triageable",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"typeable",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"canSetIssueFields",storageKey:null}],storageKey:null},K={alias:null,args:null,kind:"ScalarField",name:"securityPolicyUrl",storageKey:null},v={alias:null,args:null,kind:"ScalarField",name:"contributingFileUrl",storageKey:null},R={alias:null,args:null,kind:"ScalarField",name:"codeOfConductFileUrl",storageKey:null},I={alias:null,args:null,kind:"ScalarField",name:"supportFileUrl",storageKey:null},C={alias:null,args:null,kind:"ScalarField",name:"shortDescriptionHTML",storageKey:null};return{fragment:{argumentDefinitions:[e,l],kind:"Fragment",metadata:null,name:"RepositoryPickerCurrentRepoQuery",selections:[{alias:null,args:a,concreteType:"Repository",kind:"LinkedField",name:"repository",plural:!1,selections:[{kind:"InlineDataFragmentSpread",name:"RepositoryPickerRepository",selections:[n,i,s,r,{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"owner",plural:!1,selections:[i,t,o,u],storageKey:null},d,c,m,g,y,p,k,f,h,b,F,S,K,v,R,I,C],args:null,argumentDefinitions:[]}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[l,e],kind:"Operation",name:"RepositoryPickerCurrentRepoQuery",selections:[{alias:null,args:a,concreteType:"Repository",kind:"LinkedField",name:"repository",plural:!1,selections:[n,i,s,r,{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"owner",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},i,t,o,u,n],storageKey:null},d,c,m,g,y,p,k,f,h,b,F,S,K,v,R,I,C],storageKey:null}]},params:{id:"879d32a9dc352a457ab903e69f73531b",metadata:{},name:"RepositoryPickerCurrentRepoQuery",operationKind:"query",text:null}}}();i.hash="9a52cb1e86ad007165589ba8bfc9e6a1";let s=function(){var e={defaultValue:null,kind:"LocalArgument",name:"hasIssuesEnabled"},l={defaultValue:null,kind:"LocalArgument",name:"owner"},a={defaultValue:10,kind:"LocalArgument",name:"topRepositoriesFirst"},n={kind:"Variable",name:"hasIssuesEnabled",variableName:"hasIssuesEnabled"},i={kind:"Variable",name:"owner",variableName:"owner"},s=[{kind:"Variable",name:"first",variableName:"topRepositoriesFirst"},n,{kind:"Literal",name:"orderBy",value:{direction:"DESC",field:"UPDATED_AT"}},i],r={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"databaseId",storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},u={alias:null,args:null,kind:"ScalarField",name:"nameWithOwner",storageKey:null},d={alias:null,args:null,kind:"ScalarField",name:"login",storageKey:null},c={alias:null,args:[{kind:"Literal",name:"size",value:64}],kind:"ScalarField",name:"avatarUrl",storageKey:"avatarUrl(size:64)"},m={alias:null,args:null,kind:"ScalarField",name:"issueTypesEnabled",storageKey:null},g={alias:null,args:null,kind:"ScalarField",name:"isLocked",storageKey:null},y={alias:null,args:null,kind:"ScalarField",name:"isPrivate",storageKey:null},p={alias:null,args:null,kind:"ScalarField",name:"visibility",storageKey:null},k={alias:null,args:null,kind:"ScalarField",name:"isArchived",storageKey:null},f={alias:null,args:null,kind:"ScalarField",name:"isInOrganization",storageKey:null},h={alias:null,args:null,kind:"ScalarField",name:"hasIssuesEnabled",storageKey:null},b={alias:null,args:null,kind:"ScalarField",name:"hasAnyTemplates",storageKey:null},F={alias:null,args:null,kind:"ScalarField",name:"slashCommandsEnabled",storageKey:null},S={alias:null,args:null,kind:"ScalarField",name:"viewerCanPush",storageKey:null},K={alias:null,args:null,kind:"ScalarField",name:"isBlankIssuesEnabled",storageKey:null},v={alias:null,args:[{kind:"Literal",name:"action",value:"create an issue"}],kind:"ScalarField",name:"viewerInteractionLimitReasonHTML",storageKey:'viewerInteractionLimitReasonHTML(action:"create an issue")'},R={alias:null,args:null,concreteType:"IssueCreationPermissions",kind:"LinkedField",name:"viewerIssueCreationPermissions",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"labelable",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"milestoneable",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"assignable",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"triageable",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"typeable",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"canSetIssueFields",storageKey:null}],storageKey:null},I={alias:null,args:null,kind:"ScalarField",name:"securityPolicyUrl",storageKey:null},C={alias:null,args:null,kind:"ScalarField",name:"contributingFileUrl",storageKey:null},L={alias:null,args:null,kind:"ScalarField",name:"codeOfConductFileUrl",storageKey:null},P={alias:null,args:null,kind:"ScalarField",name:"supportFileUrl",storageKey:null},T={alias:null,args:null,kind:"ScalarField",name:"shortDescriptionHTML",storageKey:null};return{fragment:{argumentDefinitions:[e,l,a],kind:"Fragment",metadata:null,name:"RepositoryPickerTopRepositoriesQuery",selections:[{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"viewer",plural:!1,selections:[{kind:"InlineDataFragmentSpread",name:"RepositoryPickerTopRepositories",selections:[{alias:null,args:s,concreteType:"RepositoryConnection",kind:"LinkedField",name:"topRepositories",plural:!1,selections:[{alias:null,args:null,concreteType:"RepositoryEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"Repository",kind:"LinkedField",name:"node",plural:!1,selections:[{kind:"InlineDataFragmentSpread",name:"RepositoryPickerRepository",selections:[r,t,o,u,{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"owner",plural:!1,selections:[t,d,c,m],storageKey:null},g,y,p,k,f,h,b,F,S,K,v,R,I,C,L,P,T],args:null,argumentDefinitions:[]}],storageKey:null}],storageKey:null}],storageKey:null}],args:[n,i,{kind:"Variable",name:"topRepositoriesFirst",variableName:"topRepositoriesFirst"}],argumentDefinitions:[{defaultValue:!0,kind:"LocalArgument",name:"hasIssuesEnabled"},l,a]}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,e,l],kind:"Operation",name:"RepositoryPickerTopRepositoriesQuery",selections:[{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:s,concreteType:"RepositoryConnection",kind:"LinkedField",name:"topRepositories",plural:!1,selections:[{alias:null,args:null,concreteType:"RepositoryEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"Repository",kind:"LinkedField",name:"node",plural:!1,selections:[r,t,o,u,{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"owner",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},t,d,c,m,r],storageKey:null},g,y,p,k,f,h,b,F,S,K,v,R,I,C,L,P,T],storageKey:null}],storageKey:null}],storageKey:null},r],storageKey:null}]},params:{id:"a8e855345115db42d01698ae7146f655",metadata:{},name:"RepositoryPickerTopRepositoriesQuery",operationKind:"query",text:null}}}();s.hash="73e96d7c429663ba233d926c532b97e4";let r={kind:"InlineDataFragment",name:"RepositoryPickerTopRepositories"};r.hash="e0e9b7e454f1af88664982ac1af0ab15";let t=function(){var e={defaultValue:null,kind:"LocalArgument",name:"after"},l={defaultValue:null,kind:"LocalArgument",name:"searchQuery"},a=[{kind:"Variable",name:"after",variableName:"after"},{kind:"Literal",name:"first",value:10},{kind:"Variable",name:"query",variableName:"searchQuery"},{kind:"Literal",name:"type",value:"REPOSITORY"}],n={alias:null,args:null,kind:"ScalarField",name:"repositoryCount",storageKey:null},i={alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null}],storageKey:null},s={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"databaseId",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"nameWithOwner",storageKey:null},u={alias:null,args:null,kind:"ScalarField",name:"login",storageKey:null},d={alias:null,args:[{kind:"Literal",name:"size",value:64}],kind:"ScalarField",name:"avatarUrl",storageKey:"avatarUrl(size:64)"},c={alias:null,args:null,kind:"ScalarField",name:"issueTypesEnabled",storageKey:null},m={alias:null,args:null,kind:"ScalarField",name:"isLocked",storageKey:null},g={alias:null,args:null,kind:"ScalarField",name:"isPrivate",storageKey:null},y={alias:null,args:null,kind:"ScalarField",name:"visibility",storageKey:null},p={alias:null,args:null,kind:"ScalarField",name:"isArchived",storageKey:null},k={alias:null,args:null,kind:"ScalarField",name:"isInOrganization",storageKey:null},f={alias:null,args:null,kind:"ScalarField",name:"hasIssuesEnabled",storageKey:null},h={alias:null,args:null,kind:"ScalarField",name:"hasAnyTemplates",storageKey:null},b={alias:null,args:null,kind:"ScalarField",name:"slashCommandsEnabled",storageKey:null},F={alias:null,args:null,kind:"ScalarField",name:"viewerCanPush",storageKey:null},S={alias:null,args:null,kind:"ScalarField",name:"isBlankIssuesEnabled",storageKey:null},K={alias:null,args:[{kind:"Literal",name:"action",value:"create an issue"}],kind:"ScalarField",name:"viewerInteractionLimitReasonHTML",storageKey:'viewerInteractionLimitReasonHTML(action:"create an issue")'},v={alias:null,args:null,concreteType:"IssueCreationPermissions",kind:"LinkedField",name:"viewerIssueCreationPermissions",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"labelable",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"milestoneable",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"assignable",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"triageable",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"typeable",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"canSetIssueFields",storageKey:null}],storageKey:null},R={alias:null,args:null,kind:"ScalarField",name:"securityPolicyUrl",storageKey:null},I={alias:null,args:null,kind:"ScalarField",name:"contributingFileUrl",storageKey:null},C={alias:null,args:null,kind:"ScalarField",name:"codeOfConductFileUrl",storageKey:null},L={alias:null,args:null,kind:"ScalarField",name:"supportFileUrl",storageKey:null},P={alias:null,args:null,kind:"ScalarField",name:"shortDescriptionHTML",storageKey:null},T={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null};return{fragment:{argumentDefinitions:[e,l],kind:"Fragment",metadata:null,name:"RepositoryPickerSearchRepositoriesQuery",selections:[{alias:null,args:a,concreteType:"SearchResultItemConnection",kind:"LinkedField",name:"search",plural:!1,selections:[n,i,{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"nodes",plural:!0,selections:[{kind:"InlineFragment",selections:[{kind:"InlineDataFragmentSpread",name:"RepositoryPickerRepository",selections:[s,r,t,o,{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"owner",plural:!1,selections:[r,u,d,c],storageKey:null},m,g,y,p,k,f,h,b,F,S,K,v,R,I,C,L,P],args:null,argumentDefinitions:[]}],type:"Repository",abstractKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[l,e],kind:"Operation",name:"RepositoryPickerSearchRepositoriesQuery",selections:[{alias:null,args:a,concreteType:"SearchResultItemConnection",kind:"LinkedField",name:"search",plural:!1,selections:[n,i,{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"nodes",plural:!0,selections:[T,{kind:"InlineFragment",selections:[s,r,t,o,{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"owner",plural:!1,selections:[T,r,u,d,c,s],storageKey:null},m,g,y,p,k,f,h,b,F,S,K,v,R,I,C,L,P],type:"Repository",abstractKey:null},{kind:"InlineFragment",selections:[s],type:"Node",abstractKey:"__isNode"}],storageKey:null}],storageKey:null}]},params:{id:"392fbb9abc2faf4bfbefe56a8f56f434",metadata:{},name:"RepositoryPickerSearchRepositoriesQuery",operationKind:"query",text:null}}}();t.hash="d55c88eae1b92354a9ca57beeaa62299";let o=function(){var e={defaultValue:null,kind:"LocalArgument",name:"issueId"},l={defaultValue:null,kind:"LocalArgument",name:"searchQuery"},a=[{kind:"Variable",name:"id",variableName:"issueId"}],n=[{kind:"Literal",name:"first",value:10},{kind:"Variable",name:"query",variableName:"searchQuery"}],i={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},s={alias:null,args:null,kind:"ScalarField",name:"databaseId",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"nameWithOwner",storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"login",storageKey:null},u={alias:null,args:[{kind:"Literal",name:"size",value:64}],kind:"ScalarField",name:"avatarUrl",storageKey:"avatarUrl(size:64)"},d={alias:null,args:null,kind:"ScalarField",name:"issueTypesEnabled",storageKey:null},c={alias:null,args:null,kind:"ScalarField",name:"isLocked",storageKey:null},m={alias:null,args:null,kind:"ScalarField",name:"isPrivate",storageKey:null},g={alias:null,args:null,kind:"ScalarField",name:"visibility",storageKey:null},y={alias:null,args:null,kind:"ScalarField",name:"isArchived",storageKey:null},p={alias:null,args:null,kind:"ScalarField",name:"isInOrganization",storageKey:null},k={alias:null,args:null,kind:"ScalarField",name:"hasIssuesEnabled",storageKey:null},f={alias:null,args:null,kind:"ScalarField",name:"hasAnyTemplates",storageKey:null},h={alias:null,args:null,kind:"ScalarField",name:"slashCommandsEnabled",storageKey:null},b={alias:null,args:null,kind:"ScalarField",name:"viewerCanPush",storageKey:null},F={alias:null,args:null,kind:"ScalarField",name:"isBlankIssuesEnabled",storageKey:null},S={alias:null,args:[{kind:"Literal",name:"action",value:"create an issue"}],kind:"ScalarField",name:"viewerInteractionLimitReasonHTML",storageKey:'viewerInteractionLimitReasonHTML(action:"create an issue")'},K={alias:null,args:null,concreteType:"IssueCreationPermissions",kind:"LinkedField",name:"viewerIssueCreationPermissions",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"labelable",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"milestoneable",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"assignable",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"triageable",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"typeable",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"canSetIssueFields",storageKey:null}],storageKey:null},v={alias:null,args:null,kind:"ScalarField",name:"securityPolicyUrl",storageKey:null},R={alias:null,args:null,kind:"ScalarField",name:"contributingFileUrl",storageKey:null},I={alias:null,args:null,kind:"ScalarField",name:"codeOfConductFileUrl",storageKey:null},C={alias:null,args:null,kind:"ScalarField",name:"supportFileUrl",storageKey:null},L={alias:null,args:null,kind:"ScalarField",name:"shortDescriptionHTML",storageKey:null},P={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null};return{fragment:{argumentDefinitions:[e,l],kind:"Fragment",metadata:null,name:"RepositoryPickerPossibleTransferRepositoriesQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{kind:"InlineFragment",selections:[{alias:null,args:n,concreteType:"RepositoryConnection",kind:"LinkedField",name:"possibleTransferRepositoriesForViewer",plural:!1,selections:[{alias:null,args:null,concreteType:"RepositoryEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"Repository",kind:"LinkedField",name:"node",plural:!1,selections:[{kind:"InlineDataFragmentSpread",name:"RepositoryPickerRepository",selections:[i,s,r,t,{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"owner",plural:!1,selections:[s,o,u,d],storageKey:null},c,m,g,y,p,k,f,h,b,F,S,K,v,R,I,C,L],args:null,argumentDefinitions:[]}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Issue",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[l,e],kind:"Operation",name:"RepositoryPickerPossibleTransferRepositoriesQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[P,{kind:"InlineFragment",selections:[{alias:null,args:n,concreteType:"RepositoryConnection",kind:"LinkedField",name:"possibleTransferRepositoriesForViewer",plural:!1,selections:[{alias:null,args:null,concreteType:"RepositoryEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"Repository",kind:"LinkedField",name:"node",plural:!1,selections:[i,s,r,t,{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"owner",plural:!1,selections:[P,s,o,u,d,i],storageKey:null},c,m,g,y,p,k,f,h,b,F,S,K,v,R,I,C,L],storageKey:null}],storageKey:null}],storageKey:null}],type:"Issue",abstractKey:null},i],storageKey:null}]},params:{id:"6db12f999b75ae56862ef49036427962",metadata:{},name:"RepositoryPickerPossibleTransferRepositoriesQuery",operationKind:"query",text:null}}}();o.hash="1ef5b2852bfdfa6a351139b04aa4fefc";let u={kind:"InlineDataFragment",name:"RepositoryPickerRepository"};u.hash="bedcb4484e554a309e48476e49cff526";var d=a(67126),c=a(19918),m=a(38143),g=a(86391),y=a(43258),p=a(46747),k=a(38621),f=a(21373),h=a(34164),b=a(96540),F=a(18312),S=a(82490);let K={repositoryPickerContainer:"RepositoryPicker-module__repositoryPickerContainer--dRyEx",hideContainer:"RepositoryPicker-module__hideContainer--HKeTk",Item:"RepositoryPicker-module__Item--F8hZe"};function v(e){return(0,F.readInlineData)(C,e)}function R(e){return((0,F.readInlineData)(I,e).topRepositories.edges||[]).flatMap(e=>e?.node?[v(e.node)]:[])}let I=r,C=u;async function L(e,l,a){let n=await (0,F.fetchQuery)(e,i,{owner:l,name:a},{fetchPolicy:"store-or-network"}).toPromise();return n?.repository!=null?v(n.repository):null}async function P(e,l={}){let{first:a=10,hasIssuesEnabled:n,owner:i}=l,r=await (0,F.fetchQuery)(e,s,{topRepositoriesFirst:a,hasIssuesEnabled:n,owner:i},{fetchPolicy:"store-or-network"}).toPromise();return r?.viewer==null?[]:R(r.viewer)}async function T(e,l){let a=await new Promise((a,n)=>{(0,F.fetchQuery)(e,t,{searchQuery:(0,S.J)(l.query),after:l.after}).subscribe({start:e=>{l.onStart?.(e)},next:e=>{a(e)},error:e=>{n(e)}})});if(a?.search==null)return{repositories:[],totalCount:0,endCursor:null};let n=(a.search.nodes||[]).flatMap(e=>e?[v(e)]:[]);return{repositories:n,totalCount:a.search.repositoryCount||0,endCursor:a.search.pageInfo.endCursor||null}}let w=()=>(0,n.jsx)(f.Q,{leadingVisual:k.RepoIcon,trailingVisual:k.TriangleDownIcon,disabled:!0,children:c.k.selectRepository});function _({initialRepository:e,onSelect:l,preventDefault:a,organization:i,topRepositories:s,focusRepositoryPicker:r,enforceAtleastOneSelected:u,options:{hasIssuesEnabled:R,readonly:I,includeForks:C}={hasIssuesEnabled:void 0,readonly:!1,includeForks:!1},renderTrailingVisual:L,exclude:P,"aria-labelledby":T,"aria-describedby":w,anchorElement:_,title:N,subtitle:E,preventClose:$,triggerOpen:D,onOpen:M,onClose:x,ignoredRepositories:A,repositoryFilter:O,customNoResultsItem:U,customNoResultsTitle:V,repoNameOnly:j,pickerId:Q,currentRepoVisibility:z,issueId:H,responsiveOnNarrow:q,notice:B,insidePortal:W,hideContainer:Y}){let{addToast:J}=(0,y.Y6)(),[Z,G]=(0,b.useState)(e),[X,ee]=(0,b.useState)(""),[el,ea]=(0,b.useState)(void 0),[en,ei]=(0,b.useState)(null==s),es=(0,b.useRef)(X);(0,b.useEffect)(()=>{null!=s&&ei(!1)},[s]);let er=(0,F.useRelayEnvironment)(),et=(0,b.useCallback)(e=>{if(H){if(""===e.trim()){ea(void 0),ei(!1);return}ei(!0),(0,F.fetchQuery)(er,o,{searchQuery:e,issueId:H}).subscribe({next:l=>{if(null!==l){let a=(l.node?.possibleTransferRepositoriesForViewer?.edges||[]).flatMap(e=>e?.node?[v(e.node)]:[]),n=es.current;e.trim()===n.trim()&&(ea(a),ei(!1))}},error:()=>{ei(!1)}})}},[er,H]),eo=(0,b.useCallback)((e,l)=>{if(""===e.trim()){ea(void 0),ei(!1);return}ei(!0),(0,F.fetchQuery)(er,t,{searchQuery:(0,S.J)(e,{organization:i,excludeRepo:P,includeForks:C,repositoryVisibility:z})}).subscribe({next:a=>{if(null!==a){let n=(a.search.nodes||[]).flatMap(e=>e?[v(e)]:[]);R&&(n=n.filter(e=>e.hasIssuesEnabled===R));let i=n.sort((e,a)=>l.includes(e.owner.login)&&!l.includes(a.owner.login)?-1:!l.includes(e.owner.login)&&l.includes(a.owner.login)?1:e.owner.login.localeCompare(a.owner.login));if(A){let e=new Set(A);i=i.filter(l=>!e.has(l.nameWithOwner))}O&&(i=i.filter(O));let s=es.current;e.trim()===s.trim()&&(ea(i),ei(!1))}},error:()=>{ei(!1),J({type:"error",message:d.S.couldNotSearchRepositories})}})},[er,i,P,C,R,A,O,J,z]),eu=(0,p.d)(e=>{H?et(e):eo(e,ep)},m.t.pickerDebounceTime),ed=(0,b.useCallback)(e=>e.id,[]),ec=(0,b.useRef)(null);(0,b.useEffect)(()=>{r&&ec.current?.focus()},[ec,r]);let em=(0,b.useCallback)(({...l})=>{if(_)return _(l);let a=e?j?e.name:e.nameWithOwner:"No repository selected",i=e?`Selected repository: ${a}`:c.k.selectRepository;return(0,n.jsx)(f.Q,{leadingVisual:k.RepoIcon,trailingVisual:k.TriangleDownIcon,"aria-label":i,"aria-labelledby":T,"aria-describedby":w,...l,disabled:I,ref:ec,children:e?(0,n.jsx)("span",{children:j?e.name:`${e.owner.login}/${e.name}`}):c.k.selectRepository})},[_,w,T,e,I,j]),eg=(0,b.useCallback)(e=>({id:`${e.id}_${e.databaseId}_${e.slashCommandsEnabled}`,children:(0,n.jsx)("span",{children:j?e.name:`${e.owner.login}/${e.name}`}),source:e,leadingVisual:()=>e.isPrivate?(0,n.jsx)(k.LockIcon,{size:12}):(0,n.jsx)(k.RepoIcon,{size:12}),trailingVisual:L?.(e.id),className:K.Item}),[L,j]),ey=(0,b.useMemo)(()=>{let l=s||[];if(Z&&!l.find(e=>e.id===Z.id)&&(l=[Z,...l]),e&&!l.find(l=>l.id===e.id)&&(l=[e,...l]),i&&(l=l.filter(e=>e.owner.login===i)),P&&(l=l.filter(e=>e.nameWithOwner!==P)),A){let e=new Set(A);l=l.filter(l=>!e.has(l.nameWithOwner))}return l.slice(0,10)},[s,Z,e,i,P,A]),ep=(0,b.useMemo)(()=>[...new Set(ey.map(e=>e.owner.login))],[ey]),ek=(0,b.useMemo)(()=>{if(el)return el;let e=ey.filter(e=>!e.isArchived);return O?e.filter(O):e},[ey,O,el]);(0,b.useEffect)(()=>{e||!(ek.length>0)||a||l(ek[0])},[]);let ef=(0,b.useCallback)(e=>{if(I)return;let l=e.trim();X!==l&&(eu(l),ee(l),es.current=l)},[I,X,eu]),eh=(0,b.useMemo)(()=>0===ek.length,[ek.length]),eb=(0,b.useMemo)(()=>eh?{title:V??"No repositories match",body:U??"Try searching with a different query for results.",variant:"empty"}:void 0,[eh,V,U]);return(0,n.jsx)("div",{className:(0,h.$)(K.repositoryPickerContainer,Y&&K.hideContainer),"data-testid":"repository-picker-container",children:(0,n.jsx)(g.O,{items:ek,initialSelectedItems:e?[e]:[],filterItems:ef,getItemKey:ed,convertToItemProps:eg,placeholderText:c.k.selectRepository,selectionVariant:"single",onSelectionChange:([e])=>l(e),loading:en,renderAnchor:em,selectPanelRef:ec,enforceAtleastOneSelected:u,resultListAriaLabel:"Repository results",height:"large",width:"medium",title:N,subtitle:E,preventClose:$,triggerOpen:D,onOpen:M,onClose:x,pickerId:Q,improvedNoMatchAccessibility:eh,noMatchMessage:eb,notice:B,responsiveOnNarrow:q,insidePortal:W})})}try{w.displayName||(w.displayName="RepositoryPickerPlaceholder")}catch{}try{_.displayName||(_.displayName="RepositoryPicker")}catch{}},19918:(e,l,a)=>{a.d(l,{k:()=>n});let n={noAssignees:"Assignee",assignees:"Assignees",assigneesHeader:e=>`Assign up to ${e} people to this issue`,cantEditItems:e=>`Cannot edit ${e} right now`,copilotDisplayName:"Copilot",copilotDescription:"Your AI pair programmer",noLabels:"Label",labels:"Labels",labelsHeader:"Apply labels to this issue",editLabels:"Edit labels",noProjects:"Project",noMilestones:"Milestone",milestonesHeader:"Set milestone",issueHeader:"Choose issue",noIssues:"Issue",noIssueTypes:"Issue Type",filterOrganizations:"Filter organizations",organizationLabel:"Organization",selectAssignees:"Select assignees",selectMilestones:"Select milestone",selectIssue:"Select issue",selectIssueTypes:"Select issue type",typesHeader:"Select issue type",fieldsHeader:"Select issue field",fieldSingleSelectHeader:"Select an option",fieldSingleSelectHeaderWithName:e=>`Select ${e}`,selectProjects:"Select projects",selectLabels:"Select labels",selectRepository:"Select repository",selectBranch:"Select a branch",selectPr:"Select a pull request",searchPr:"Search pull requests",maxPRsLinkingWarning:"You may only link 10 pull requests to this issue across all repositories.",filterUsers:e=>`Filter ${e.toLowerCase()}s`,filterMilestones:"Filter milestones",filterIssueTypes:"Filter issue types",filterProjects:"Filter projects",noPullRequest:"no pull request",milestones:{pastDue:"Past due by",milestoneClosed:"Closed",milestoneDue:"Due by",noDueDate:"No due date",progressPercentage:e=>e?`, ${Math.round(e)}% complete`:", not started"},testIds:{relativeTimeDescription:"relative-time-description"},getNumberOfSelectedPrsLabel:e=>1===e?`${e} pull request selected`:`${e} pull requests selected`,projectItemsLimitReached:"This project has reached the maximum of 50,000 items. To add more, please delete existing items from the project.",closeButton:"Close dialog",projectItemsLimitReachedDialogLabel:"Project items limit reached dialog",projectItemsLimitReachedDialogTitle:"Project limits reached",projectItemsLimitReachedDialogMessage:"One or more of the projects you selected has reached the maximum of 50,000 items. To add more, please delete existing items from the selected project(s).",limitWarning:e=>1===e?`You have reached the limit of ${e} assignee`:`You have reached the limit of ${e} assignees`}},34267:(e,l,a)=>{a.d(l,{D:()=>r,t:()=>t});var n=a(74848),i=a(96540);let s=(0,i.createContext)({updateOpenState:()=>void 0,anyItemPickerOpen:()=>!1});function r({children:e}){let l=(0,i.useRef)({}),a=(0,i.useCallback)((e,a)=>{let n=l.current;return n[e]===a||(l.current={...n,[e]:a}),l.current},[]),r=(0,i.useCallback)(()=>Object.values(l.current).some(e=>e),[l]),t=(0,i.useMemo)(()=>({updateOpenState:a,anyItemPickerOpen:r}),[r,a]);return(0,n.jsx)(s.Provider,{value:t,children:e})}function t(){let e=(0,i.useContext)(s);if(!e)throw Error("useItemPickersContext must be used within a ItemPickersContextProvider.");return e}try{s.displayName||(s.displayName="ItemPickersContext")}catch{}try{r.displayName||(r.displayName="ItemPickersContextProvider")}catch{}},38143:(e,l,a)=>{a.d(l,{t:()=>n});let n={pickerDebounceTime:200,labelsPageSize:50,labelsInitialLoadCount:100,milestonesPageSize:100,milestonesMaxPreloadCount:1e3,organizationsMaxPreloadCount:1e3,organizationsPageSize:100,maximumSuggestedUsers:30}},57019:(e,l,a)=>{a.d(l,{A:()=>r,_:()=>t});var n=a(88431),i=a(44569),s=a(96540);let r={ctrlKey:"ctrlKey",altKey:"altKey",shiftKey:"shiftKey",metaKey:"metaKey"},t=(e,l,a)=>{let t=(0,s.useRef)(l);(0,n.N)(()=>{t.current=l});let o=(0,s.useCallback)(l=>{(![...document.querySelectorAll('#__primerPortalRoot__, [id$="-portal-root"]')].some(function e(l){if(l.clientHeight>0)return!0;for(let a of l.children)if(e(a))return!0;return!1})||a?.triggerWhenPortalIsActive)&&(function(e,l){for(let a of Object.values(r))if(l&&l[a]&&!e[a]||e[a]&&(!l||!l[a]))return!1;return!0}(l,a)||a?.ignoreModifierKeys)&&!(!a?.triggerWhenInputElementHasFocus&&(0,i.fg)(l.target))&&e.some(e=>/^\d$/.test(e)?l.code===`Digit${e}`:"/"===e?"Slash"===l.code:l.key===e)&&t.current(l)},[e,a]);(0,s.useEffect)(()=>{let e=a?.scopeRef?.current||document;return e.addEventListener("keydown",o),()=>e.removeEventListener("keydown",o)},[o,a?.scopeRef])}},67126:(e,l,a)=>{a.d(l,{S:()=>n});let n={couldNotUpdateAssignees:"Could not update assignees",couldNotSearchAssignees:"Could not search assignees",couldNotUpdateLabels:"Could not update labels",couldNotSearchLabels:"Could not search labels",couldNotUpdateMilestone:"Could not update milestone",couldNotUpdateType:"Could not update type",couldNotSearchMilestones:"Could not search milestones",couldNotUpdateIssueType:"Could not update issue type",couldNotSearchRepositories:"Could not search repositories",couldNotSearchPullRequests:"Could not search pull requests",couldNotSearchProjects:"Could not search projects",couldNotSearchBranches:"Could not search branches",noMatches:"No matches",noResults:"No results",couldNotCreateBranch:"Could not create branch",couldNotCreateLabel:"Could not create label",couldNotCreateMilestone:"Could not create milestone",branchAlreadyExists:e=>`The branch ${e} already exists.`}},74563:(e,l,a)=>{a.d(l,{B:()=>n});let n={itemPickerRootId:"item-picker-root-id",itemPickerTestId:"item-picker-root"}},76027:(e,l,a)=>{a.d(l,{Z:()=>n});let n={activePickerOption:e=>`[data-id="${e}"] [data-is-active-descendant="activated-directly"]`}},82490:(e,l,a)=>{a.d(l,{J:()=>n});function n(e,l){let a=e.indexOf("/"),n="in:name archived:false";if(l?.excludeRepo&&(n=`${n} -repo:${l.excludeRepo}`),l?.includeForks&&(n=`${n} fork:true`),l?.repositoryVisibility&&"PUBLIC"!==l.repositoryVisibility&&(n=`${n} -visibility:public`),a>0&&2===e.split("/").length){let l=e.split("/")[0],a=e.split("/")[1];return`${n} org:${l} ${a}`}return l?.organization?`${n} org:${l.organization} ${e}`:`${n} ${e}`}},86391:(e,l,a)=>{a.d(l,{D:()=>f,O:()=>k});var n=a(74848),i=a(69599),s=a(53419),r=a(83494),t=a(57019),o=a(93330),u=a(5839),d=a(50279),c=a(96540),m=a(74563),g=a(76027),y=a(34267),p=a(89850);function k({items:e,initialSelectedItems:l,placeholderText:a,selectionVariant:k="single",loading:h,groups:b,filterItems:F,renderAnchor:S,getItemKey:K,convertToItemProps:v,onSelectionChange:R,onOpen:I,onClose:C,onLiveSelectionChange:L,eventsTag:P,height:T="small",width:w="small",selectPanelRef:_,enforceAtleastOneSelected:N,insidePortal:E,maxVisibleItems:$=9,nested:D=!1,resultListAriaLabel:M,title:x,subtitle:A,preventClose:O,triggerOpen:U,initialFilter:V,customNoResultsItem:j,customNoMatchItem:Q,footer:z,keybindingCommandId:H,pickerId:q,responsiveOnNarrow:B,secondaryAction:W,notice:Y,className:J,improvedNoMatchAccessibility:Z,noMatchMessage:G,suppressNoMatchItem:X}){let[ee,el]=(0,c.useState)(U??!1),[ea,en]=(0,c.useState)(ee?Date.now():null),[ei,es]=(0,c.useState)([]),[er,et]=(0,c.useState)(V??""),{updateOpenState:eo,anyItemPickerOpen:eu}=(0,y.t)(),[ed,ec]=(0,c.useState)(!1),em=(0,c.useId)();q&&(em=q);let eg=(0,i.G7)("issues_react_blur_item_picker_on_close"),ey=B||(0,i.G7)("primer_react_select_panel_fullscreen_on_narrow");(0,o.w)(()=>{ec(window.innerWidth<768)});let ep=(0,c.useCallback)(e=>{el(e),e?en(Date.now()):en(null)},[el]);(0,c.useEffect)(()=>{void 0!==U&&ep(U)},[ep,U]);let ek=(0,c.useCallback)(()=>{eu()||ee||(ep(!0),I&&I())},[eu,ee,ep,I]);(0,c.useEffect)(()=>{eo(em,ee)},[em,ee,eo]);let ef=(0,c.useMemo)(()=>new Map,[em,l]),eh=(0,c.useCallback)(e=>{for(let[,l]of ef)l!==e&&(l.selected=!1)},[ef]),eb=(0,c.useCallback)(e=>"string"==typeof e?e:K(e),[K]),eF=(0,c.useCallback)((e,a)=>{if(O&&!e||"cancel"===a)return;if(eg&&!e&&document.activeElement instanceof HTMLElement&&document.activeElement?.blur(),ep(e),e&&I)return void I();et(""),C&&C();let n=[...ef.values()].filter(e=>e.selected).map(e=>e.source);if(n.length!==l.length||n.some(e=>!l.some(l=>eb(l)===K(e)))){if(ea&&P){let e=Date.now()-ea,a=n.filter(e=>!l.some(l=>eb(l)===K(e))).length,i=l.filter(e=>!n.some(l=>eb(l)===K(e))).length;(0,s.BI)(`item-picker-${P}-selection-duration`,{selectionDuration:e,totalItemsCount:n.length,addedItemsCount:a,removedItemsCount:i})}R(n)}},[O,eg,ep,I,C,ef,l,eb,K,ea,P,R]),eS=(0,c.useCallback)((e,l)=>{let a=K(e),n=ef.get(a),i=v(e);if(n)return{...n,disabled:i.disabled};(n=i).selected=l;let s=n.onAction;return n.onAction=(l,n)=>{let i=ef.get(a);i&&(i.selected=!i.selected,"single"===k&&e.id!==er&&eh(i),s&&s(l,n))},ef.set(a,n),n},[v,er,K,ef,k,eh]),eK=(0,c.useMemo)(()=>{let a=e.map(e=>e.__isNew__?(delete e.__isNew__,Q&&ef.delete(K(Q)),eS(e,!0)):eS(e,l.some(l=>eb(l)===K(e))));return 0===a.length?Z?[]:Q?[eS(Q,!1)]:X?[]:er?[Q?eS(Q,!1):p.Q3]:[j??p.v8]:a},[Q,e,ef,eS,l,eb,K,er,j,Z,X]);(0,c.useEffect)(()=>{es(eK.filter(e=>e.selected))},[eK]);let ev=(0,c.useMemo)(()=>"single"===k?ei[0]:ei,[ei,k]),eR=(0,c.useCallback)(e=>{if(void 0===e){N||es([]);return}let l=(Array.isArray(e)?e:[e]).map(e=>eK.find(l=>e.id===l.id)).filter(e=>void 0!==e);es(l),L&&L(l.map(e=>e.source))},[N,eK,L]);(0,t._)([" "],e=>{if(ee){let l=document.querySelector(g.Z.activePickerOption(m.B.itemPickerRootId));if(l){let a=l.getAttribute("data-id"),n=[...ef.values()].find(e=>e.id===a);if(n){if(v(n.source).disabled)return;e.preventDefault(),e.stopPropagation(),n.selected=!n.selected,es([...ef.values()].filter(e=>e.selected)),L&&L([...ef.values()].filter(e=>e.selected).map(e=>e.source))}}}},{triggerWhenInputElementHasFocus:!0,triggerWhenPortalIsActive:!0});let eI=(0,c.useCallback)(()=>{if(O)return;et("");let e=[...ef.values()].filter(e=>e.selected).map(e=>e.source);if(e.length!==l.length||e.some(e=>!l.some(l=>eb(l)===K(e)))){for(let e of ef.values())l.some(l=>eb(l)===K(e.source))?e.selected=!0:e.selected=!1;es([...ef.values()].filter(e=>e.selected))}ep(!1),C&&C()},[O,ef,l,ep,C,eb,K]);(0,c.useEffect)(()=>{F(er)},[er,F]);let eC=eK.length>0;1===eK.length&&(eK[0].id===p.Q3.id||eK[0].id===p.v8.id)&&(eC=!1);let eL=(0,c.useMemo)(()=>b&&b?.length>1&&eC?{groupMetadata:b}:{},[b,eC]),eP=f(E,_,eK.length<=$?"auto":T,ed&&ey),eT=(0,c.useMemo)(()=>G||(er?{variant:"empty",title:"No matches found",body:"Try a different search term"}:{variant:"empty",title:"No items to show",body:""}),[G,er]),ew=(0,c.useMemo)(()=>({renderAnchor:S,placeholderText:a,open:ee,onOpenChange:eF,loading:h,items:eK,selected:ev,onSelectedChange:eR,filterValue:er,onFilterChange:et,showItemDividers:!0,overlayProps:{width:w,className:J,...eP},...eL,"aria-label":M,"data-id":m.B.itemPickerRootId,"data-testid":m.B.itemPickerTestId,title:x,subtitle:A,footer:z,onCancel:eI,secondaryAction:W,notice:Y,message:Z&&0===eK.length?eT:void 0}),[S,a,ee,eF,h,eK,ev,eR,er,w,eP,eL,M,x,A,z,eT,eI,W,Y,J,Z]);return(0,n.jsxs)(d.g,{flags:{primer_react_select_panel_fullscreen_on_narrow:void 0===z&&ey},children:[H&&(0,n.jsx)(r.ak,{commands:{[H]:ek}}),(0,n.jsx)(u.X,{anchorRef:D?void 0:_,...ew})]})}function f(e,l,a,n=!1){let i=e?"large":a;if(!e||!l?.current)return{height:i};let{top:s}=l.current.getBoundingClientRect(),r=n?0:s-436;return r<0?{height:i}:{height:i,top:r,position:"fixed"}}try{k.displayName||(k.displayName="ItemPicker")}catch{}},89850:(e,l,a)=>{a.d(l,{A2:()=>t,Q3:()=>s,v8:()=>r});var n=a(38621),i=a(67126);let s={leadingVisual:n.CircleSlashIcon,text:i.S.noMatches,disabled:!0,selected:void 0,key:"no-matches",id:"no-matches"},r={leadingVisual:n.CircleSlashIcon,text:i.S.noResults,disabled:!0,selected:void 0,key:"no-results",id:"no-results"},t=(e="",l="",a="")=>{let n=e&&`owner:${e.trim()} `,i=a&&`repo:${a.trim()} `,s=l&&`${l.trim()}`,r=(e=>{try{new URL(e)}catch{return!1}return new RegExp(/^.+\/issues\/\d+$/).test(e)})(l),t="in:title",o=s&&"#"===s.charAt(0)?s.slice(1):s;o&&!isNaN(Number(o))&&(t+=" in:number");let u=`${n}${i}is:issue ${t}`;return{commenters:`${u} commenter:@me ${s}`.trim(),mentions:`${u} mentions:@me ${s}`.trim(),assignee:`${u} assignee:@me ${s}`.trim(),author:`${u} author:@me ${s}`.trim(),other:`${u} ${s}`.trim(),resource:r?encodeURI(l):"",queryIsUrl:r}}}}]); //# sourceMappingURL=packages_item-picker_components_RepositoryPicker_tsx-6554dcefb23b.js.map